package com.cloud.wyf.Entity;

public class Message<T> {
    private Integer status;
    private T message;
    private boolean success;

    private Message(Integer status, T message, boolean success) {
        this.status = status;
        this.message = message;
        this.success = success;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public T getMessage() {
        return message;
    }

    public void setMessage(T message) {
        this.message = message;
    }

    public boolean isSuccess() {
        return success;
    }

    public void setSuccess(boolean success) {
        this.success = success;
    }

    public static <T>Message<T> success(){
        return new Message<>(200,null,true);
    }
    public static <T>Message<T> success(T data){
        return new Message<>(200,data,true);
    }
    public static <T>Message<T> failure(int status,T data){
        return new Message<>(status,data,false);
    }
    public static <T>Message<T> failure(int status){
        return new Message<>(status,null,false);
    }
    public static <T>Message<T> failure(T data){
        return new Message<>(400,data,false);
    }
}
